package com.adapter;

import java.util.List;

import com.ocr.*;
import com.entity.Language;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class LanguageAdapter extends ArrayAdapter<Language> {
	private List<Language> listlLanguages;
	private Context context;
	private int redId;
	public LanguageAdapter(Context context, int resource,List<Language> list) {
		super(context, resource, list);
		// TODO Auto-generated constructor stub
		this.context=context;
		this.listlLanguages=list;
		this.redId=resource;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if(convertView==null)
		{
			LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView=inflater.inflate(redId, null);
		}
		TextView textViewName=(TextView) convertView.findViewById(R.id.txt_language_name);
		textViewName.setText(listlLanguages.get(position).getName());
		return convertView;
	}
	

	
}
